﻿using FactoryDeviceSystem.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FactoryDeviceSystem.Controls
{
    public partial class DeviceControl : UserControl
    {
        public DeviceControl()
        {
            InitializeComponent();
            Rectangle rect = this.ClientRectangle;
            System.Drawing.Drawing2D.GraphicsPath path = DrawUtil.GetRoundPath(rect, 5);
            this.Region = new Region(path);
            SizeChanged += DeviceControl_SizeChanged;
        }

        private void DeviceControl_SizeChanged(object sender, EventArgs e)
        {
            Rectangle rect = this.ClientRectangle;
            System.Drawing.Drawing2D.GraphicsPath path = DrawUtil.GetRoundPath(rect, 5);
            this.Region = new Region(path);
        }

       
        private bool state = false;

        public bool State
        {
            get { return state; }
            set
            {
                state = value;
                uSwitch.Checked = value;
            }
        }
        public string DevNo { get; set; }

        private string devName = "101设备";

        public string DevName
        {
            get { return devName; }
            set
            {
                devName = value;
                devNameLb.Text = devName;
            }
        }

        private int power = 0;

        public int Power
        {
            get { return power; }
            set
            {
                power = value;
                powerLb.ParamValue = power.ToString();
            }
        }

        private float temperature = 1.01f;

        public float Temperature
        {
            get { return temperature; }
            set
            {
                temperature = value;
                tempLb.ParamValue = temperature.ToString("#.##");
            }
        }

        private int speed = 0;

        public int Speed
        {
            get { return speed; }
            set
            {
                speed = value;
                speedLb.ParamValue = speed.ToString();
            }
        }

        private float pressure = 1.01f;

        public float Pressure
        {
            get { return pressure; }
            set
            {
                pressure = value;
                pressLb.ParamValue = pressure.ToString("#.##");
            }
        }
    }
}
